package day09;

public class stringTools02 {
    public static void main(String[] args) {
        String str=new String("abcd");
        String str2="abcd";
        String str3="abcd";
        System.out.println(str.toString());
        System.out.println(str.hashCode());
        System.out.println(str2.hashCode());
        System.out.println(str==str2);//false,没有高效效果
        System.out.println(str.equals(str2));//true
        System.out.println(str2==str3);//true,有高效效果
        char[] value={'a','b','c','d'};
        String str4=new String(value);
        System.out.println("****************");
        System.out.println(str4.equals(str));
        System.out.println(str4.equals(str2));
        System.out.println(str4.equals(str3));
        System.out.println("****************");
        System.out.println(str4==str);
        System.out.println(str4==str2);
        System.out.println(str4==str3);
    }
}

